package com.zz.hhbl.api

import com.zz.hhbl.config.AppConfig
import com.zz.framework.core.annotation.BaseUrl
import com.zz.framework.core.http.HttpResponse
import com.zz.hhbl.entity.ChatTokenConfigEntity
import com.zz.hhbl.entity.ConfigTempEntity
import com.zz.hhbl.entity.DigitalHumanEntity
import com.zz.hhbl.entity.FenceEntity
import com.zz.hhbl.entity.SpotInfoEntity
import com.zz.hhbl.entity.SpotPointEntity
import com.zz.hhbl.entity.TourGuideCommentaryEntity
import com.zz.hhbl.entity.TranslateAudioGetStatusResponse
import com.zz.hhbl.entity.TranslateCreateResponse
import com.zz.hhbl.entity.VersionEntity
import com.zz.hhbl.entity.VersionWrapEntity
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query
import retrofit2.http.QueryMap

@BaseUrl(
    baseUrl = AppConfig.BASE_URL,//正式地址
    debugBaseUrl = AppConfig.BASE_URL_DEBUG//测试地址
)
interface ApiService {
    @POST("/loginDevice")
    suspend fun loginDevice(@Body params: HashMap<String, Any?>): HttpResponse<String>

    /**
     * 获取各个模块的版本号
     */
    @POST("/business/app/getVersion")
    suspend fun getVersion(@Body params: HashMap<String, Any?>): HttpResponse<VersionWrapEntity>

    /**
     * 景点信息
     */
    @POST("/business/app/getSpotInfo")
    suspend fun getSpotInfo(@Body params: HashMap<String, Any?>): HttpResponse<SpotInfoEntity>

    /**
     * 获取讲解词数据
     * @param params HashMap<String, Any?>
     * @return HttpResponse<List<TourGuideCommentaryEntity>>
     */
    @POST("/business/app/getTourGuideCommentary")
    suspend fun getTourGuideCommentary(@Body params: HashMap<String, Any?>): HttpResponse<List<TourGuideCommentaryEntity>>

    /**
     * 电子围栏
     * @param params HashMap<String, Any?>
     * @return HttpResponse<List<TourGuideCommentaryEntity>>
     */
    @POST("/business/app/fence")
    suspend fun fence(@Body params: HashMap<String, Any?>): HttpResponse<List<FenceEntity>>

    /**
     * 数字人
     * @param params HashMap<String, Any?>
     * @return HttpResponse<List<DigitalHumanEntity>>
     */
    @POST("/business/app/digital-human")
    suspend fun digitalHuman(@Body params: HashMap<String, Any?>): HttpResponse<List<DigitalHumanEntity>>

    /**
     * 获取所有缓存
     * @param params HashMap<String, Any?>
     * @return HttpResponse<Map<String, ConfigTempEntity?>>
     */
    @POST("/business/app/getAllData")
    suspend fun getAllData(@Body params: HashMap<String, Any?>): HttpResponse<Map<String, ConfigTempEntity>>

    /**
     * 设备状态  违规进入电子围栏范围告警信息
     * 状态 (0: 正常, 1: 锁机, 2: 关机)
     * @param params HashMap<String, Any?>
     * @return HttpResponse<List<DigitalHumanEntity>>
     */
    @POST("/business/app/syncDeviceStatus")
    suspend fun syncDeviceStatus(@Body params: HashMap<String, Any?>): HttpResponse<Any>

    /**
     * 告警类型 1：带出景区报警 2：带出景区围栏锁机 3：带入禁入区报警 4：带入禁入区围栏锁机
     * @param params HashMap<String, Any?>
     * @return HttpResponse<Any>
     */
    @POST("/business/app/fenceWarning")
    suspend fun fenceWarning(@Body params: HashMap<String, Any?>): HttpResponse<Any>

    /**
     * 获取聊天token
     * @param deviceNumber String?
     * @return HttpResponse<ChatTokenConfigEntity>
     */
    @GET("/business/volcanoVoiceChat/getChatTokenConfig")
    suspend fun getChatTokenConfig(@Query("deviceNumber") deviceNumber: String?): HttpResponse<ChatTokenConfigEntity>

    /**
     * 智能体加入房间
     * @param deviceNumber String?
     * @param voiceType String?
     * @return HttpResponse<ChatTokenConfigEntity>
     */
    @GET("/business/volcanoVoiceChat/startVoiceChat")
    suspend fun startVoiceChat(@QueryMap params: HashMap<String, Any?>): HttpResponse<ChatTokenConfigEntity>

    @POST("/business/app/getMapSpotPointMarks")
    suspend fun getMapSpotPointMarks(@Body params: HashMap<String, Any?> = hashMapOf()): HttpResponse<List<SpotPointEntity>>

    /**
     * 智能体退出房间
     * @param deviceNumber String?
     * @return HttpResponse<ChatTokenConfigEntity>
     */
    @GET("/business/volcanoVoiceChat/stopVoiceChat")
    suspend fun stopVoiceChat(@Query("deviceNumber") deviceNumber: String?): HttpResponse<Any>

    @POST("/business/volcanoVoiceChat/updateVoiceChat")
    suspend fun updateVoiceChat(@Body params: HashMap<String, Any?>): HttpResponse<Any>

    @POST("/business/app/recordSosInfo")
    suspend fun recordSosInfo(@Body params: HashMap<String, Any?>): HttpResponse<Any>

    @Multipart
    @POST("http://222.212.90.223:42059/api/Audio/Create")
    suspend fun audioCreate(@Part("SourceLanguage") sourceLanguage: RequestBody,
                            @Part("TargetLanguage") targetLanguage: RequestBody,
                            @Part file: MultipartBody.Part,
                            ): TranslateCreateResponse

    @GET("http://222.212.90.223:42059/api/Audio/GetStatus")
    suspend fun audioGetStatus(@QueryMap params: HashMap<String, Any?>): TranslateAudioGetStatusResponse

    @GET("http://222.212.90.223:42059/api/Audio/GetResult")
    suspend fun audioGetResult(@QueryMap params: HashMap<String, Any?>): HttpResponse<Any>

}